<link rel="prefetch" href="<%= path_to_javascript 'application' %>" as="script" />

<% if Rails.application.read_only? %>
  <p>
  The site is currently in read-only mode for maintenance.
  </p>
<% else %>
  <%= form_with url: login_path do |form| %>
    <div class="labelled_grid">
      <%= form.label :email, "E-mail or Username" %>
      <%= form.text_field :email, :size => 40, :inputmode => "email", :autofocus => "autofocus" %>

      <%= form.label :password, "Password" %>
      <%= form.password_field :password, :size => 30 %>
    </div>
    <%= form.submit "Login" %>

    <p>
      Forgot your password or deleted your account?
      <%= link_to "Reset your password", forgot_password_path %>.
    </p>

    <% if Rails.application.open_signups? %>
      <p>
        Not a user yet? <a href="/invitations/open">Sign up here</a>.
      </p>
      <% elsif Rails.application.allow_invitation_requests? %>
      <p>
        Not a user yet? <a href="/invitations/request">Request an invite</a>.
      </p>
    <% else %>
      <p>
      Not a user yet?
      Read about <a href="/about#invitations">how invitations work</a> and see if you know
      <%= link_to 'a current user', users_tree_path %> of the site.
      The <a href="/chat">chat room</a> does not require an invitation.
      </p>
    <% end %>

    <% if @referer.present? %>
      <%= form.hidden_field :referer, value: @referer %>
    <% end %>
  <% end %>
<% end %>
